<?php
/**
 * CreateTime: 2023/12/7 16:43
 * User:LinQ
 */

namespace App\Http\Requests\User;

use App\Http\Requests\BasicFormRequests;

class ManageUserRequest  extends BasicFormRequests
{
    protected $rule =[
        'name' => 'required',
        'com_id' => 'required',
        'department_id' => 'required',
        'account' => 'required',
        'password' => 'required',
        'leader_id' => 'user_id_has'
    ];

    public function __construct(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null)
    {
        $this->message = [
            'name.required'=>trans('message.request_required',[
                'name' => trans('key.user_name')
            ]),
            'com_id.required'=>trans('message.request_required',[
                'name' => trans('key.company')
            ]),
            'department_id.required'=>trans('message.request_required',[
                'name' => trans('key.department')
            ]),
            'account.required'=>trans('message.request_required',[
                'name' => trans('key.account')
            ]),
            'password.required'=>trans('message.request_required',[
                'name' => trans('key.password')
            ]),
            'leader_id.user_id_has' =>trans('message.request_required',[
                'name' => trans('key.leader')
            ])
        ];
        parent::__construct($query, $request, $attributes, $cookies, $files, $server, $content);
    }


    protected $scene = [
        'create' => ['name','account','password','leader_id','com_id','department_id'],
        'update' => ['leader_id|user_id_has']
    ];
}